/**
 wrote in emacs, possible error detected, testing...
 Aisyren, ELIA.
**/


import java.awt.Color;
import java.awt.Point;

public class ColorTriangle extends Triangle
{
    private Color color;
    public ColorTriangle(Color c, Point p1, Point p2, Point p3)
    {
	super(p1, p2, p3);
	color = c;
    }

    /**
    // v1
    public boolean equals(Object obj)
    {
	if( !(obj instanceof ColorTriangle) )
	{
	    return false;
	}
	
	ColorTriangle otherCT = (ColorTriangle)obj;
	return super.equals(otherCT) && this.color.equals(otherCT.color);
    }
    **/

    /**
    // v2
    public boolean equals(Object obj)
    {
	if( obj instanceof ColorTriangle )
	{
	    ColorTriangle oct = (ColorTriangle) obj;

	    return super.equals(oct) && this.color.equals(oct.color); 
	}
	else if( obj instanceof Triangle)
	{
	    return super.equals(obj);
	}
	else
	{
	    return false;
	}
    }
    **/

    //v3
    public boolean equals(Object obj)
    {
	if(obj == null)
	{
	    return false;
	}
	if(obj.getClass() != this.getClass())
	{
	    return false;
	}
	if(!super.equals(obj))
	{
	    return false;
	}

	ColorTriangle oct = (ColorTriangle)obj;
	return this.color.equals(oct.color);
    }

}

